﻿using LPLS.Commons.DBModule;
using LPLS.DBEntities;
using LPLS.DBEntities.ConfigModels.AlarmModels;
using LPLS.DBInterface;
using LPLS.DBInterface.ConfigModels.AlarmModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LPLS.DBServices.ConfigModels.AlarmModel
{
    public  class AlarmVarableCodeConfigService : DBBaseService, IAlarmVarableCodeConfigService
    {
        public AlarmVarableCodeConfigService(DBContext dbContext) : base(dbContext)
        {
        }

    

        public List<AlarmVarableCodeConfig> GetData()
        {

            return   DbContext.GetDbContext(DataBaseName).Queryable<AlarmVarableCodeConfig>()
                .LeftJoin<AlarmVarableConfig>((code,var)=>code.AlarmVarableID==var.Id)
                .Select((code,var)=> new AlarmVarableCodeConfig { 
                
                VarName=var.VarName
                
                },true)
                
                .ToList();
        }

        public override void InitDataBaseName()
        {
            DataBaseName = DatabaseEnum.SqliteConfig.ToString();
        }
    }
}
